/*  1:   */ package nl.siegmann.epublib.bookprocessor;
/*  2:   */ 
/*  3:   */ import java.io.IOException;
/*  4:   */ import nl.siegmann.epublib.domain.Book;
/*  5:   */ import nl.siegmann.epublib.domain.Resource;
/*  6:   */ import nl.siegmann.epublib.domain.Resources;
/*  7:   */ import nl.siegmann.epublib.epub.BookProcessor;
/*  8:   */ import nl.siegmann.epublib.service.MediatypeService;
/*  9:   */ import org.slf4j.Logger;
/* 10:   */ import org.slf4j.LoggerFactory;
/* 11:   */ 
/* 12:   */ public abstract class HtmlBookProcessor
/* 13:   */   implements BookProcessor
/* 14:   */ {
/* 15:23 */   private static final Logger log = LoggerFactory.getLogger(HtmlBookProcessor.class);
/* 16:   */   public static final String OUTPUT_ENCODING = "UTF-8";
/* 17:   */   
/* 18:   */   public Book processBook(Book book)
/* 19:   */   {
/* 20:31 */     for (Resource resource : book.getResources().getAll()) {
/* 21:   */       try
/* 22:   */       {
/* 23:33 */         cleanupResource(resource, book);
/* 24:   */       }
/* 25:   */       catch (IOException e)
/* 26:   */       {
/* 27:35 */         log.error(e.getMessage(), e);
/* 28:   */       }
/* 29:   */     }
/* 30:38 */     return book;
/* 31:   */   }
/* 32:   */   
/* 33:   */   private void cleanupResource(Resource resource, Book book)
/* 34:   */     throws IOException
/* 35:   */   {
/* 36:42 */     if (resource.getMediaType() == MediatypeService.XHTML)
/* 37:   */     {
/* 38:43 */       byte[] cleanedHtml = processHtml(resource, book, "UTF-8");
/* 39:44 */       resource.setData(cleanedHtml);
/* 40:45 */       resource.setInputEncoding("UTF-8");
/* 41:   */     }
/* 42:   */   }
/* 43:   */   
/* 44:   */   protected abstract byte[] processHtml(Resource paramResource, Book paramBook, String paramString)
/* 45:   */     throws IOException;
/* 46:   */ }


/* Location:           C:\Users\David\workspace\CosaRaraPorqueSi\main\epublib-tools-3.1.jar
 * Qualified Name:     nl.siegmann.epublib.bookprocessor.HtmlBookProcessor
 * JD-Core Version:    0.7.0.1
 */